package com.lge.pitchingcoins.util;

import android.util.Log;

public class PitchingCoinsLog {
    public static boolean debugMode = true;
    private static final String AppTag = "PitchingCoinsLog";

    public static String getCallerInfo() {
        String info = " ";

        StackTraceElement ste = Thread.currentThread().getStackTrace()[4];
        if (ste == null)
            return info;

        String fileName = ste.getFileName();
        String methodName = ste.getMethodName();
        int lineNumber = ste.getLineNumber();
        info = "(at " + fileName + " " + methodName + " " + Integer.toString(lineNumber) + ")";

        return info;
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    public static void i(String log, Throwable tr) {
        if (debugMode) {
            Log.i(AppTag, log + " " + getCallerInfo(), tr);
        }
    }

    public static void d(String log, Throwable tr) {
        if (debugMode) {
            Log.d(AppTag, log + " " + getCallerInfo(), tr);
        }
    }

    public static void v(String log, Throwable tr) {
        if (debugMode) {
            Log.v(AppTag, log + " " + getCallerInfo(), tr);
        }
    }

    public static void e(String log, Throwable tr) {
        if (debugMode) {
            Log.e(AppTag, log + " " + getCallerInfo(), tr);
        }
    }

    public static void w(String log, Throwable tr) {
        if (debugMode) {
            Log.w(AppTag, log + " " + getCallerInfo(), tr);
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////

    /////////////////////////////////////////////////////////////////////////////////////////
    public static void i(String log) {
        if (debugMode) {
            Log.i(AppTag, log + " " + getCallerInfo());
        }
    }

    public static void d(String log) {
        if (debugMode) {
            Log.d(AppTag, log + " " + getCallerInfo());
        }
    }

    public static void v(String log) {
        if (debugMode) {
            Log.v(AppTag, log + " " + getCallerInfo());
        }
    }

    public static void e(String log) {
        if (debugMode) {
            Log.e(AppTag, log + " " + getCallerInfo());
        }
    }

    public static void w(String log) {
        if (debugMode) {
            Log.w(AppTag, log + " " + getCallerInfo());
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////
    
    /////////////////////////////////////////////////////////////////////////////////////////
    public static void i(String sTag, String log) {
        if (debugMode) {
            Log.i(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo());
        }
    }

    public static void d(String sTag, String log) {
        if (debugMode) {
            Log.d(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo());
        }
    }

    public static void v(String sTag, String log) {
        if (debugMode) {
            Log.v(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo());
        }
    }

    public static void e(String sTag, String log) {
        if (debugMode) {
            Log.e(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo());
        }
    }

    public static void w(String sTag, String log) {
        if (debugMode) {
            Log.w(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo());
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////
    
    /////////////////////////////////////////////////////////////////////////////////////////
    public static void i(String sTag, String log, Throwable tr) {
        if (debugMode) {
            Log.i(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo(), tr);
        }
    }

    public static void d(String sTag, String log, Throwable tr) {
        if (debugMode) {
            Log.d(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo(), tr);
        }
    }

    public static void v(String sTag, String log, Throwable tr) {
        if (debugMode) {
            Log.v(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo(), tr);
        }
    }

    public static void e(String sTag, String log, Throwable tr) {
        if (debugMode) {
            Log.e(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo(), tr);
        }
    }

    public static void w(String sTag, String log, Throwable tr) {
        if (debugMode) {
            Log.w(AppTag, "[" + sTag + "]" + log + " " + getCallerInfo(), tr);
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////

}